<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-menu default-active='active' mode='horizontal' class='menu-unit'>
      <el-menu-item v-for='item in Container1' :index="'流程明细'===item.name?'active':'default'">
        <el-link @click="gotoMenu(item.url)" :type="'流程明细'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
      </el-menu-item>
    </el-menu>
    <table cellpadding="4" cellspacing="0" border="0" width="100%">
      <tr>
        <td class="containerBack">
          <el-form ref="form" :model="s_img" :rules="rules" label-width="100px" id="mvcfm">
            <table cellspacing="0" border="0" class='el-table el-table--fit el-table--enable-row-hover el-table--enable-row-transition'>
              <tbody class="el-table__body">
                <tr v-for="(trrow, trindex) in s_img">
                  <td v-for="(row, status) in trrow">
                    <p>
                      <img src='images/icons/talent/nopic.jpg' width='19' height='17' />
                    </p>
                    <p>
                      {{row.name}}
                    </p>
                  </td>
                </tr>
              </tbody>
            </table>
            <el-button @click="gotoPage('/mes/produce/flow/TimeSet?'+vueparams+'')" type='primary' size="mini">设置时间</el-button>
            <div class="form-unit">
              <span class="mvc-title-left"> 生产明细 </span>
            </div>
            <el-table :data="tree_steps">
              <el-table-column label="操作" align="center" width='100' type=''>
                <template slot-scope="scope">
                  <el-dropdown trigger="click">
                    <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                    <el-dropdown-menu slot="dropdown">
                      <el-dropdown-item>
                        <el-link @click="gotoPage('/mes/produce/flow/NextAdd?CMID6='+emt.map.process_id+'&CMID3='+emt.map.item_work_id+'&'+vueparams+'')">调整设备</el-link>
                      </el-dropdown-item>
                      <el-dropdown-item>
                        <el-link @click="gotoPage('/mes/produce/flow/AdjustJump?CMID6='+emt.map.process_id+'&CMID3='+emt.map.item_work_id+'&'+vueparams+'')">调整跳转</el-link>
                      </el-dropdown-item>
                      <el-dropdown-item>
                        <el-link @click="gotoPage('/mes/produce/flow/StepMove?CMID6='+emt.map.process_id+'&CMID3='+emt.map.item_work_id+'&'+vueparams+'')">移动</el-link>
                      </el-dropdown-item>
                      <el-dropdown-item>
                        <el-link @click="gotoPage('/mes/produce/flow/StepTimeSet?CMID6='+emt.map.process_id+'&CMID3='+emt.map.item_work_id+'&'+vueparams+'')">调整时长</el-link>
                      </el-dropdown-item>
                      <el-dropdown-item>
                        <el-link @click="gotoPage('/mes/produce/flow/AdjustTeam?CMID6='+emt.map.process_id+'&CMID3='+emt.map.item_work_id+'&'+vueparams+'')">调整班组</el-link>
                      </el-dropdown-item>
                    </el-dropdown-menu>
                  </el-dropdown>
                </template>
              </el-table-column>
              <el-table-column label="步骤" prop="workName">
              </el-table-column>
              <el-table-column label="工位" prop="position_id">
                <template slot-scope="scope">
                  <el-link @click="gotoPage('/mes/produce/StationDet?CMID2='+scope.row.position_id+''+vueparams+'')" type='primary'>{{scope.row.name}}</el-link>
                </template>
              </el-table-column>
              <el-table-column label="完成日期" prop="end_time">
              </el-table-column>
              <el-table-column label="工作组" prop="assigned_id">
              </el-table-column>
              <el-table-column label="工作能力(S)" prop="produce_able">
              </el-table-column>
              <el-table-column label="需要数量" prop="sum_no">
              </el-table-column>
              <el-table-column label="开始工时" prop="start_inttime">
                <template slot-scope="scope">
                  {{getDateString(scope.row,'start_inttime')}}
                </template>
              </el-table-column>
              <el-table-column label="结束工时" prop="end_inttime">
                <template slot-scope="scope">
                  {{getDateString(scope.row,'end_inttime')}}
                </template>
              </el-table-column>
              <el-table-column label="开始时间点" prop="start_time">
              </el-table-column>
              <el-table-column label="结束时间点" prop="end_time">
              </el-table-column>
            </el-table>
          </el-form>
        </td>
      </tr>
    </table>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'FlowDetailed',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        s_img: [],
        tree_steps: [],
        loading: false,
        Container1: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.loadContainerMenu({
        pid: "3FB71F06EF24449EA08DAA333F42CD9C",
        name: "流程图右菜单",
        selected: "流程明细"
      }, 'Container1', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/produce/flow/ProducePlan/flowDetailed?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
          this["tree_steps"] = this.loadTreeTable(this["tree_steps"], "id", "pid");
        })
      },
    },
  }
</script>
